import { getAction, deleteAction, putAction, putparamsAction, postAction, httpAction } from '@/api/manage'
import { formatParamsToUrl } from "@/utils/format-data"

// 不合格原因
const unqualifiedReasonList = (params) => getAction('/jksaas-produce/produce/unqualifiedreason/qualityUnqualifiedReason/list', params)
const unqualifiedReasonAdd = (params) => postAction('/jksaas-produce/produce/unqualifiedreason/qualityUnqualifiedReason/add', params)
const unqualifiedReasonEdit = (params) => putAction('/jksaas-produce/produce/unqualifiedreason/qualityUnqualifiedReason/edit', params)
const unqualifiedReasonDetail = (params) => getAction('/jksaas-produce/produce/unqualifiedreason/qualityUnqualifiedReason/queryById', params)
const unqualifiedReasonDel = (params) => deleteAction('/jksaas-produce/produce/unqualifiedreason/qualityUnqualifiedReason/deleteBatch', params)

// 不合格项
const unqualifiedList = (params) => getAction('/basic/basicNonconformity/list', params)
const unqualifiedAdd = (params) => postAction('/jksaas-produce/produce/unqualifieditems/qualityUnqualifiedItems/add', params)
const unqualifiedEdit = (params) => putAction('/jksaas-produce/produce/unqualifieditems/qualityUnqualifiedItems/edit', params)
const unqualifiedDetail = (params) => getAction('/jksaas-produce/produce/unqualifieditems/qualityUnqualifiedItems/queryById', params)
const unqualifiedDel = (params) => deleteAction('/jksaas-produce/produce/unqualifieditems/qualityUnqualifiedItems/deleteBatch', params)
const unqualifiedCheckName = (params) => getAction('', params) // 检查名称(接口不对,)

export const qualityUnqualifiedItems = (params) => getAction('/jksaas-produce/produce/unqualifieditems/qualityUnqualifiedItems/getList', params)


// 检验项
const inspectionItemsList = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckItem/list', params)
const inspectionItemsAdd = (params) => postAction('/jksaas-produce/produce/quality/qualityCheckItem/add', params)
const inspectionItemsEdit = (params) => putAction('/jksaas-produce/produce/quality/qualityCheckItem/edit', params)
const inspectionItemsDetail = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckItem/querySpecification', params)
const inspectionItemsDel = (params) => deleteAction('/jksaas-produce/produce/quality/qualityCheckItem/delete', params)
const inspectionItemsCheckName = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckItem/queryName', params) // 检查名称

//检验方案
const inspectionSchemeCheckName = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckProgram/queryName', params) // 检查名称
const inspectionSchemeAdd = (params) => postAction('/jksaas-produce/produce/quality/qualityCheckProgram/add', params)
const inspectionSchemeEdit = (params) => putAction('/jksaas-produce/produce/quality/qualityCheckProgram/edit', params)
const inspectionSchemeList = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckProgram/list', params)
const inspectionSchemeDel = (params) => deleteAction('/jksaas-produce/produce/quality/qualityCheckProgram/delete', params)
const inspectionSchemeDetail = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckProgram/selectById', params)
const deleteBatch = (params) => deleteAction('/jksaas-produce/produce/event/managementAbnormalEvent/deleteBatch', params)
const AnomadeleteBatch = (params) => deleteAction('/jksaas-produce/produce/cause/managementAnomalousCause/deleteBatch', params)

// 检验规范
const inspectionSpecificationsList = (params) => {
  return getAction('/jksaas-produce/produce/quality/qualityCheckSpecification/list'+formatParamsToUrl(params))
}
const inspectionSpecificationsCheckName = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckSpecification/queryName', params) // 检查名称
const inspectionSpecificationsAdd = (params) => postAction('/jksaas-produce/produce/quality/qualityCheckSpecification/add', params)
const inspectionSpecificationsDel = (params) => deleteAction('/jksaas-produce/produce/quality/qualityCheckSpecification/delete', params)
const inspectionSpecificationsDetail = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckItem/selectByRefId', params)
const inspectionSpecificationsEdit = (params) => putAction('/jksaas-produce/produce/quality/qualityCheckSpecification/edit', params)
const inspectionSpecificationsfilters = (params) => getAction('/jksaas-produce/produce/quality/qualityCheckItem/siftByCode', params)

// 生产追溯
const productionTraceabilityAdd = (params) => postAction('/quality/qualityCheckSpecification/add', params)
const productionTraceabilityDel = (params) => deleteAction('/quality/qualityCheckSpecification/delete', params)
const productionTraceabilityDetail = (params) => getAction('/quality/qualityCheckItem/selectByRefId', params)
const productionTraceabilityEdit = (params) => putAction('/quality/qualityCheckSpecification/edit', params)
const productionTraceabilityList = (params) => postAction('/quality/qualityCheckProgram/list', params)

// 质检巡检
const inspectionInspectionAdd = (params) => postAction('/jksaas-produce/produce/qualityInspection/qualityInspection/add', params)

const managementAbnormalEvent = (params) => getAction('/jksaas-produce/produce/event/managementAbnormalEvent/list', params)
const managementAbnormalEventadd = (params) => postAction('/jksaas-produce/produce/event/managementAbnormalEvent/add', params)
const queryById = (params) => getAction('/jksaas-produce/produce/event/managementAbnormalEvent/queryById', params)
const edit = (params) => putAction('/jksaas-produce/produce/event/managementAbnormalEvent/edit', params)
const managementAnomalousCause = (params) => getAction('/jksaas-produce/produce/cause/managementAnomalousCause/list', params)
const ListAdd = (params) => postAction('/jksaas-produce/produce/cause/managementAnomalousCause/add', params)
const managementedit = (params) => putAction('/jksaas-produce/produce/cause/managementAnomalousCause/edit', params)
const AnomalqueryById = (params) => getAction('/jksaas-produce/produce/cause/managementAnomalousCause/queryById', params)
const produceQualityCodeRuleCreateCode = (params) => getAction('/jksaas-produce/produce/produceQuality/produceQualityCodeRule/createCode', params)

export {
  unqualifiedReasonAdd,
  unqualifiedReasonList,
  unqualifiedReasonEdit,
  unqualifiedReasonDetail,
  unqualifiedReasonDel,

  unqualifiedList,
  unqualifiedAdd,
  unqualifiedEdit,
  unqualifiedDetail,
  unqualifiedDel,
  unqualifiedCheckName,

  inspectionItemsList,
  inspectionItemsDel,
  inspectionItemsAdd,
  inspectionItemsEdit,
  inspectionItemsDetail,
  inspectionItemsCheckName,

  inspectionSchemeCheckName,
  inspectionSchemeAdd,
  inspectionSchemeEdit,
  inspectionSchemeList,
  inspectionSchemeDel,
  inspectionSchemeDetail,

  inspectionSpecificationsList,
  inspectionSpecificationsCheckName,
  inspectionSpecificationsAdd,
  inspectionSpecificationsDel,
  inspectionSpecificationsDetail,
  inspectionSpecificationsEdit,
  inspectionSpecificationsfilters,

  productionTraceabilityList,
  productionTraceabilityAdd,
  productionTraceabilityDel,
  productionTraceabilityDetail,
  productionTraceabilityEdit,

  inspectionInspectionAdd,
  managementAbnormalEvent,
  managementAbnormalEventadd,
  queryById,
  edit,
  deleteBatch,
  managementAnomalousCause,
  ListAdd,
  managementedit,
  AnomalqueryById,
  AnomadeleteBatch,
  produceQualityCodeRuleCreateCode
}
